package com.hdax.dmw.scheduler.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hdax.dmw.dtos.scheduler.PriceDto;
import com.hdax.dmw.entity.scheduler.DmSchedulerSeatPrice;
import com.hdax.dmw.scheduler.mapstruct.PriceDtoMapper;
import com.hdax.dmw.scheduler.service.DmSchedulerSeatPriceService;
import com.hdax.dmw.scheduler.mappers.DmSchedulerSeatPriceMapper;
import com.hdax.dmw.utils.Result;
import com.hdax.dmw.utils.ResultGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author guoyisha
* @description 针对表【dm_scheduler_seat_price(节目排期座位价格表)】的数据库操作Service实现
* @createDate 2023-06-15 12:16:43
*/
@Service
public class DmSchedulerSeatPriceServiceImpl extends ServiceImpl<DmSchedulerSeatPriceMapper, DmSchedulerSeatPrice>
    implements DmSchedulerSeatPriceService{

    @Autowired
    private PriceDtoMapper priceDtoMapper;

    @Override
    public Result<List<PriceDto>> getPrice(Long scheduleId) {
        List<DmSchedulerSeatPrice> list = baseMapper.selectList(new QueryWrapper<DmSchedulerSeatPrice>().eq("scheduleId", scheduleId));
        List<PriceDto> dtos = priceDtoMapper.toTargetList(list);
        return ResultGenerator.genSuccessResult(dtos);
    }
}




